<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ymPrompt/ymPrompt_Ex.js"></script>
<link href="__THEME__/layout.css" rel="stylesheet" type="text/css" />
<link href="../Public/pop.css" rel="stylesheet" type="text/css" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
    <!--
    //指定当前组模块URL地址
    var	URL		=	'__URL__';
    var	APP		=	'__APP__';
    var	PUBLIC	=	'__PUBLIC__';
    var	ROOT	=	'__ROOT__';
    //-->
</script>

<script>

    <php>if($fgids){ </php>

          $(window.parent.document).find(".ym-header-text").text("修改好友分组");

            function agreeFriend(uid,nid) {
                var gids = "";
                $("input:checked").each(function(){
                    var gid = $(this).val();
                    gids += gids?(","+gid):gid;
                });

                if(!gids)  gids = 1;

                $.post(APP+"/Friend/doSetGroup",{fuid:uid,gids:gids,nid:nid},function(txt){
                    if(txt == 1){
                        $("#pop_con").html("修改分组成功!");
                        $(".btm").hide();
                       // setTimeout(function(){ parent.ymPrompt.close(); },1500);
                        //parent.location.href = __ACTION__;
                        window.parent.location.reload() ;
                      // window.opener.location.reload();
                    }else{

                    }
                });

             }
    <php>}else{</php>
      
      $(window.parent.document).find(".ym-header-text").text("同意并加为好友");

          function agreeFriend(uid,nid) {
              var old = $('.btn_b').val();
                $('.btn_b').hide();
              //$('.btn_b').attr('disabled ',true);
                var gids = "";
                $("input:checked").each(function(){
                    var gid = $(this).val();
                    gids += gids?(","+gid):gid;
                });
                if(!gids)  gids = 1;

                $.post(APP+"/Friend/agreeFriend",{fuid:uid,gids:gids,nid:nid},function(txt){
                    if(txt == '1'){
                        $("#pop_con").html("你们成为了好友!");
                        //setTimeout(function(){ parent.ymPrompt.close(); },1500);
                        window.parent.location.reload() ;
                    }else{
                        alert('网络异常，请重新同意');
                      //  $('.btn_b').val(old);
                      //  $('.btn_b').removeAttr('disabled');
                    }
                });

             }
    <php>}</php>

</script>

<div class="pop">
    <div class="con" style="margin:0px;">
	    <div style="line-height:20px;"><strong>{$uid|getUserName}是你的：</strong></div>
        <div class="gd"  id="gid" style="overflow-x:hidden;overflow-y:scroll;">
            <volist name="user_groups" id="g">
                <div style="width:50%; float:left; height:25px;">
                 <input name="gid" type="checkbox" value="{$g.id}" <php>if( in_array($g["id"],$fgids) ) echo 'checked="true"';</php>/>{$g.name}
                </div>
            </volist>
        </div>
    </div>
    <div id='pop_con' style="text-align:center; line-height:110px;"> </div>
    <div class="btm" id="f_button">
        <input name="input" type="button" class="btn_b" value="提 交" onclick="agreeFriend({$uid},{$nid})"/>
    </div>
</div>


